<!--
 * @Author: MrLee
 * @Date: 2024-08-24 08:55:14
 * @LastEditors: MrLee
 * @LastEditTime: 2024-08-25 13:10:13
 * @Description: 请填写简介
-->
<template>
  <custom-navbar title="意见反馈" :autoBack="true" leftIconColor="#303133" />
  <up-gap height="30rpx" />
  <view class="px-24rpx">
    <infocard :userInfoList="userInfoList" :rigthIco="false" />
  </view>
  <view class="shadow-[0px_0px_12px_0px_rgba(238,239,241,0.50)] fixed bottom-0 w-[100%] h-178rpx bg-#fff">
    <view
      class="w-[90%] h-82rpx mt-[24rpx] leading-[82rpx] mx-auto my-0 rounded-[42rpx] bg-#1f50f2 text-[30rpx] font-medium text-center text-white"
      @click="sendSubmit"
    >提交</view>
  </view>
</template>
    <script setup lang="ts">
import infocard from "@/pages/components/infocard/index.vue";
import {YjFk} from "@/api/user";
const userInfoList = reactive([
  {
    title: "请您直言不讳，您希望我们如何改善，才能为您提供更好的体验",
    value: "",
    valueType: "textarea",
    placeholder: "您的意见非常重要，我们将认真对待，请您详细描述",
  },
  {
    title: "上传图片",
    value: [],
    valueType: "file",
  },
]);
const sendSubmit = () => {
  console.log(userInfoList, '提交信息')
  let params = {
    content: userInfoList[0].value
  }
  let arr = []
  userInfoList[1].value.map(v => {
    arr.push(v.url)
  })
  params.image = JSON.stringify(arr)
  YjFk(params).then(res => {
    if(res) {
      uni.showToast({
        title: '提交成功',
        icon: 'none'
      })
    }else {
      uni.showToast({
        title: '提交失败',
        icon: 'none'
      })
    }
  })
};
</script>
